//
//  RootVC.m
//  first
//
//  Created by 毕小强 on 16/11/4.
//  Copyright © 2016年 毕小强. All rights reserved.
//

#import "RootVC.h"

#import "ViewController.h"
#import "HtmlEachOCVC.h"
#import "SynthesisImageVC.h"
#import "YQRefreshVC.h"
#import "XMLAnalysisVC.h"
#import "HttpVC.h"
#import "GaoDeVC.h"
#import "LocationVC.h"
#import "indexVC.h"
#import "PhotoVC.h"
#import "addressBookVC.h"
#import "DatePickVC.h"
#import "GestureVC.h"
#import "JSPatchVC.h"
@interface RootVC ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView*myTableView;
@property(nonatomic,strong)NSMutableArray*dataArr;
@end

@implementation RootVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.myTableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height) style:UITableViewStylePlain];
    self.myTableView.delegate=self;
    self.myTableView.dataSource=self;
    [self.view addSubview:_myTableView];
    self.myTableView.tableFooterView=[[UIView alloc]initWithFrame:CGRectZero];
    
    if ([_myTableView respondsToSelector:@selector(setLayoutMargins:)]) {
        [_myTableView setLayoutMargins:UIEdgeInsetsZero];
    }
    if ([_myTableView respondsToSelector:@selector(setSeparatorInset:)]) {
        [_myTableView setSeparatorInset:UIEdgeInsetsZero];
    }
    
    self.dataArr=[NSMutableArray array];
    [self.dataArr addObject:@"避开无效证书网络请求"];
    [self.dataArr addObject:@"JS与OC交互"];
    [self.dataArr addObject:@"图片合成"];
    [self.dataArr addObject:@"自定义下来刷新上拉加载"];
    [self.dataArr addObject:@"XML解析"];
    [self.dataArr addObject:@"网络请求"];
    [self.dataArr addObject:@"高德地图"];
    [self.dataArr addObject:@"实时地理位置信息"];
    [self.dataArr addObject:@"tableview索引"];
    [self.dataArr addObject:@"相册"];
    [self.dataArr addObject:@"通讯录"];
    [self.dataArr addObject:@"时间选择器"];
    [self.dataArr addObject:@"视图放大缩小移动"];
    [self.dataArr addObject:@"JSPatch"];
}
#pragma mark UITableViewDelegate,UITableViewDataSource
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString*cellID=@"cellID";
    UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell==nil) {
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    //Gill Sans
    cell.textLabel.font=[UIFont fontWithName:@"Helvetica Neue" size:15.0];
    cell.textLabel.text=_dataArr[indexPath.row];
    return cell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _dataArr.count;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.row) {
        case 0:{
            ViewController*vc=[[ViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        case 1:{
            HtmlEachOCVC*heVC=[[HtmlEachOCVC alloc]init];
            [self.navigationController pushViewController:heVC animated:YES];
            break;
        }
        case 2:{
            SynthesisImageVC *sVC=[[SynthesisImageVC alloc]init];
            [self.navigationController pushViewController:sVC animated:YES];
            break;
        }
        case 3:{
            YQRefreshVC *yVC=[[YQRefreshVC alloc]init];
            [self.navigationController pushViewController:yVC animated:YES];
            break;
        }
        case 4:{
            XMLAnalysisVC *aVC=[[XMLAnalysisVC alloc]init];
            [self.navigationController pushViewController:aVC animated:YES];
            break;
        }
        case 5:{
            HttpVC *hVC=[[HttpVC alloc]init];
            [self.navigationController pushViewController:hVC animated:YES];
            break;
        }
        case 6:{
            GaoDeVC *gVC = [[GaoDeVC alloc]init];
            [self.navigationController pushViewController:gVC animated:YES];
            break;
        }
        case 7:{
            LocationVC *lVC = [[LocationVC alloc]init];
            [self.navigationController pushViewController:lVC animated:YES];
            break;
        }
        case 8:{
            indexVC *iVC = [[indexVC alloc]init];
            [self.navigationController pushViewController:iVC animated:YES];
            break;
        }
        case 9:{
            PhotoVC *pVC = [[PhotoVC alloc]init];
            [self.navigationController pushViewController:pVC animated:YES];
            break;
        }
        case 10:{
            addressBookVC *aVC = [[addressBookVC alloc]init];
            [self.navigationController pushViewController:aVC animated:YES];
            break;
        }
        case 11:{
            DatePickVC *dVC = [[DatePickVC alloc]init];
            [self.navigationController pushViewController:dVC animated:YES];
            break;
        }
        case 12:{
            GestureVC *gVC = [[GestureVC alloc]init];
            [self.navigationController pushViewController:gVC animated:YES];
            break;
        }
        case 13:{
            JSPatchVC *jVC = [[JSPatchVC alloc]init];
            [self.navigationController pushViewController:jVC animated:YES];
            break;
            }
        default:
            break;
    }
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}
-(void)setNavigation{
    self.navigationController.title=@"Demo";
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
